package com.teamwork.module03.controller;

import com.teamwork.module03.util.EmailUtil;
import com.teamwork.common.result.Result;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/api/user")
public class EmailController {
    @Resource
    private EmailUtil emailUtil; // 引入Spring Mail依赖后，会自动装配到IOC容器。用来发送邮件
    @GetMapping("/register/sendcode")
    public Result sendCode(String username,String email){

        emailUtil.send(username,email);

        return Result.success("发送成功！");
    }
}

